package shuashuami.hb.com.fragment;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import shuashuami.hb.com.avtivity.CAgencyApplicationActivity;
import shuashuami.hb.com.avtivity.CCompleteTaskActivity;
import shuashuami.hb.com.avtivity.CDistributionCenterActivity;
import shuashuami.hb.com.avtivity.CHaveHandActivity;
import shuashuami.hb.com.avtivity.CMyRecommendActivity;
import shuashuami.hb.com.avtivity.CSettingActivity;
import shuashuami.hb.com.avtivity.CSubordinateActivity;
import shuashuami.hb.com.avtivity.CUntreatedTaskActivity;
import shuashuami.hb.com.avtivity.CUserInfoActivity;
import shuashuami.hb.com.avtivity.CWodeyuEActivity;
import shuashuami.hb.com.hbclient.R;
import shuashuami.hb.com.http.CGetUserInfo;
import shuashuami.hb.com.http.CSign;
import shuashuami.hb.com.view.ExaminePromptDialog;

/**
 * <b>类   名：</b>${TYPE_NAME} <br/>
 * <b>类描述：</b> <br/>
 * <b>创建人：</b>zhangqi<br/>
 * <b>创建时间：</b>2017/6/13<br/>
 * <b>修改人：</b>zhangqi<br/>
 * <b>修改时间：</b>2017/6/13<br/>
 * <b>修改备注：</b><br/>
 *
 * @version 1.0.0<br/>
 */
public class HbCUserFragm extends AbFragment {

    private LinearLayout llToUserInfo;
    private TextView tvSign;
    private LinearLayout llToSubordinate;
    private LinearLayout llToCagencyApplication;
    private LinearLayout llToDistributionCenter;
    private LinearLayout llToRecommend;
//    private ImageView imgSetting;

    private TextView tvMyMoney;
    private TextView tvUserName, tvLevel, tvId, tvLevelNum;
    private ImageView imgUserHead;

    private LinearLayout llToUntreatedTask;

    private TextView tvWaitSubmitNum, tvGoingNum, tvCompleteNum;

    private LinearLayout llToCHaveHand;
    private LinearLayout llToCCompleteTask;

    private LinearLayout llYuE;

    @Override
    public void initView(View v) {

        setTitleBar("我的", false);
        setRightView();
        llToUserInfo = (LinearLayout) v.findViewById(R.id.ll_cuser_to_user_info);
//        imgSetting = (ImageView) v.findViewById(R.id.img_cuser_setting);
        tvSign = (TextView) v.findViewById(R.id.tv_cuser_sign);
        llToSubordinate = (LinearLayout) v.findViewById(R.id.ll_cuser_my_subordinate);
        llToCagencyApplication = (LinearLayout) v.findViewById(R.id.ll_cuser_to_cagency_applicaton);
        llToDistributionCenter = (LinearLayout) v.findViewById(R.id.ll_cuser_to_distribution_center);
        llToRecommend = (LinearLayout) v.findViewById(R.id.ll_cuser_to_my_recommend);
        tvMyMoney = (TextView) v.findViewById(R.id.tv_cuser_balance);
        tvUserName = (TextView) v.findViewById(R.id.tv_cuser_nick_name);
        tvLevel = (TextView) v.findViewById(R.id.tv_cuser_nick_experon);
        tvId = (TextView) v.findViewById(R.id.tv_cuser_nick_id);
        tvLevelNum = (TextView) v.findViewById(R.id.tv_cuser_level_num);
        imgUserHead = (ImageView) v.findViewById(R.id.img_cuser_head_image);

        tvWaitSubmitNum = (TextView) v.findViewById(R.id.tv_cuser_wait_submit_num);
        tvGoingNum = (TextView) v.findViewById(R.id.tv_cuser_wait_going_num);
        tvCompleteNum = (TextView) v.findViewById(R.id.tv_cuser_wait_complete_num);

        llToUntreatedTask = (LinearLayout) v.findViewById(R.id.ll_cuser_to_unreadted_task);
        llToCHaveHand = (LinearLayout) v.findViewById(R.id.ll_cuser_to_c_have_hand);
        llToCCompleteTask = (LinearLayout) v.findViewById(R.id.ll_cuser_to_ccomplete_task);
        llYuE = (LinearLayout) v.findViewById(R.id.ll_cuser_yu_e);

    }

    @Override
    public void initData() {

    }

    @Override
    public void initListener() {
        llToUserInfo.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), CUserInfoActivity.class);
                startActivity(intent);
                //     initShowExaminePromptDialog();
            }
        });
        tvSign.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                CSign();
            }
        });
        setRightViewListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), CSettingActivity.class);
                startActivity(intent);
            }
        });
        llToSubordinate.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), CSubordinateActivity.class);//我的刷手
                startActivity(intent);
            }
        });
        llToCagencyApplication.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), CAgencyApplicationActivity.class);//代理申请s
                startActivity(intent);
            }
        });
        llToDistributionCenter.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), CDistributionCenterActivity.class);//分销中心
                startActivity(intent);
            }
        });
        llToRecommend.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), CMyRecommendActivity.class);
                startActivity(intent);
            }
        });
        llToUntreatedTask.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), CUntreatedTaskActivity.class);//待处理
                startActivity(intent);
            }
        });
        llToCHaveHand.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), CHaveHandActivity.class);//进行中
                startActivity(intent);
            }
        });
        llToCCompleteTask.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), CCompleteTaskActivity.class);//已完成
                startActivity(intent);
            }
        });

        llYuE.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(getActivity(), CWodeyuEActivity.class);
                startActivity(intent);
            }
        });
    }

    @Override
    public int bindView() {
        return R.layout.frag_cuser;
    }

    private void initShowExaminePromptDialog() {
        ExaminePromptDialog examinePromptDialog = new ExaminePromptDialog(getActivity());
        examinePromptDialog.show();
        ;
    }

    public void getUserInfo() {
        CGetUserInfo cGetMyMoney = new CGetUserInfo(getActivity(), tvMyMoney, tvUserName,
                tvLevel, tvId, tvLevelNum, imgUserHead, tvWaitSubmitNum, tvGoingNum, tvCompleteNum, tvSign);
        cGetMyMoney.getMessage();
    }

    private void CSign() {
        CSign cSign = new CSign(this, tvSign);
        cSign.getMessage();
    }

    @Override
    public void onResume() {
        super.onResume();
        getUserInfo();
    }
}
